Short-circuit the text to the exact same thing, so we don't unexpectedly
authorOwen Taylor <otaylor@redhat.com>
Thu, 21 Mar 2002 00:08:19 +0000 (00:08 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Thu, 21 Mar 2002 00:08:19 +0000 (00:08 +0000)
Wed Mar 20 19:00:03 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkentry.c (gtk_entry_set_text): Short-circuit
        the text to the exact same thing, so we don't
        unexpectedly change the selection or cursor position.
        (#74290, John Ellis.)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkentry.c

index e7af3fe62de6fa1321d04f92b811f5b971c8d8b6..9ef98e26272859e288620bdf101e962e9d2e602f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Mar 20 19:00:03 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkentry.c (gtk_entry_set_text): Short-circuit
+       the text to the exact same thing, so we don't 
+       unexpectedly change the selection or cursor position.
+       (#74290, John Ellis.)
+
 Thu Mar 21 00:05:14 2002  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreeview.c (gtk_tree_view_get_background_area),
index e7af3fe62de6fa1321d04f92b811f5b971c8d8b6..9ef98e26272859e288620bdf101e962e9d2e602f 100644 (file)
@@ -1,3 +1,10 @@
+Wed Mar 20 19:00:03 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkentry.c (gtk_entry_set_text): Short-circuit
+       the text to the exact same thing, so we don't 
+       unexpectedly change the selection or cursor position.
+       (#74290, John Ellis.)
+
 Thu Mar 21 00:05:14 2002  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreeview.c (gtk_tree_view_get_background_area),
index e7af3fe62de6fa1321d04f92b811f5b971c8d8b6..9ef98e26272859e288620bdf101e962e9d2e602f 100644 (file)
@@ -1,3 +1,10 @@
+Wed Mar 20 19:00:03 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkentry.c (gtk_entry_set_text): Short-circuit
+       the text to the exact same thing, so we don't 
+       unexpectedly change the selection or cursor position.
+       (#74290, John Ellis.)
+
 Thu Mar 21 00:05:14 2002  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreeview.c (gtk_tree_view_get_background_area),
index e7af3fe62de6fa1321d04f92b811f5b971c8d8b6..9ef98e26272859e288620bdf101e962e9d2e602f 100644 (file)
@@ -1,3 +1,10 @@
+Wed Mar 20 19:00:03 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkentry.c (gtk_entry_set_text): Short-circuit
+       the text to the exact same thing, so we don't 
+       unexpectedly change the selection or cursor position.
+       (#74290, John Ellis.)
+
 Thu Mar 21 00:05:14 2002  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreeview.c (gtk_tree_view_get_background_area),
index e7af3fe62de6fa1321d04f92b811f5b971c8d8b6..9ef98e26272859e288620bdf101e962e9d2e602f 100644 (file)
@@ -1,3 +1,10 @@
+Wed Mar 20 19:00:03 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkentry.c (gtk_entry_set_text): Short-circuit
+       the text to the exact same thing, so we don't 
+       unexpectedly change the selection or cursor position.
+       (#74290, John Ellis.)
+
 Thu Mar 21 00:05:14 2002  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreeview.c (gtk_tree_view_get_background_area),
index e7af3fe62de6fa1321d04f92b811f5b971c8d8b6..9ef98e26272859e288620bdf101e962e9d2e602f 100644 (file)
@@ -1,3 +1,10 @@
+Wed Mar 20 19:00:03 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkentry.c (gtk_entry_set_text): Short-circuit
+       the text to the exact same thing, so we don't 
+       unexpectedly change the selection or cursor position.
+       (#74290, John Ellis.)
+
 Thu Mar 21 00:05:14 2002  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreeview.c (gtk_tree_view_get_background_area),
index 9ef6c6e887d8946424842d5a6ef978dca704a8ed..3e6534e88ab7b844eded8d5d52a7b71301d4dca3 100644 (file)
@@ -3266,14 +3266,20 @@ gtk_entry_new_with_max_length (gint max)
 }
 
 void
-gtk_entry_set_text (GtkEntry *entry,
+gtk_entry_set_text (GtkEntry    *entry,
                    const gchar *text)
 {
   gint tmp_pos;
 
   g_return_if_fail (GTK_IS_ENTRY (entry));
   g_return_if_fail (text != NULL);
-  
+
+  /* Actually setting the text will affect the cursor and selection;
+   * if the contents don't actually change, this will look odd to the user.
+   */
+  if (strcmp (entry->text, text) == 0)
+    return;
+
   gtk_editable_delete_text (GTK_EDITABLE (entry), 0, -1);
 
   tmp_pos = 0;